# app/schemas.py

from pydantic import BaseModel
from datetime import datetime
from typing import List, Optional

class InvalidCommitSchema(BaseModel):
    sha: str
    author: str
    message: str
    url: str
    detected_at: datetime

    class Config:
        orm_mode = True

class WebhookEventSchema(BaseModel):
    id: int
    repository_name: str
    repository_owner: str
    pusher: str
    ref: str
    before_sha: str
    after_sha: str
    received_at: datetime
    invalid_commits: List[InvalidCommitSchema] = []

    class Config:
        orm_mode = True
